#include <array>
#include <iostream>
#include <string>
#include "PocoLogger/SysLogger.h"
#include "Logger/SystemLogger.h"
#include "Foundation/Foundation.h"
#include "SwTest.h"

#define POCO_MODULE_NAME "PocoSw"
#define MODULE_NAME "Sw"

using namespace SystemTool;

void TestPocoLogger()
{
    INIT_FILE_SYS_LOGGER(POCO_MODULE_NAME, "/Users/tangyingzhong/Desktop/test.log");
    SystemTool::StopWatch Sw;
    Sw.Start();

    // Foundation::Sleep_Ms(2000);
    // std::cout << "Sepnd time=" << Sw.GetElaspsed_Ms() << std::endl;
    // Sw.Restart();

    for (size_t index = 0; index < 50000; index++)
    {
        LOG_INFO(POCO_MODULE_NAME, String("I want to test %d cnt to print %s to you").Args(12).Args("thanks"));
        LOG_DEBUG(POCO_MODULE_NAME, String("I want to test %d cnt to print %s to you").Args(12).Args("thanks"));
        LOG_ERROR(POCO_MODULE_NAME, String("I want to test %d cnt to print %s to you").Args(12).Args("thanks"));
        LOG_WARN(POCO_MODULE_NAME, String("I want to test %d cnt to print %s to you").Args(12).Args("thanks"));
    }

    std::cout << "Sepnd time=" << Sw.GetElaspsed_Ms() << std::endl;
    Sw.Stop();
}

void TestLogger()
{
    INIT_FILE_LOGGER(MODULE_NAME, "/Users/tangyingzhong/Desktop/test1.log");
    SystemTool::StopWatch Sw;
    Sw.Start();

    // Foundation::Sleep_Ms(2000);
    // std::cout << "Sepnd time=" << Sw.GetElaspsed_Ms() << std::endl;
    // Sw.Restart();

    for (size_t index = 0; index < 50000; index++)
    {
        LOGE(MODULE_NAME, "I want to test {} cnt to print {} to you", 2, "THANKS");
        LOGE(MODULE_NAME, "I want to test {} cnt to print {} to you", 2, "THANKS");
        LOGE(MODULE_NAME, "I want to test {} cnt to print {} to you", 2, "THANKS");
        LOGE(MODULE_NAME, "I want to test {} cnt to print {} to you", 2, "THANKS");
        int iAge = 30;
        std::string strName = "Lily";
        LOGI(MODULE_NAME, "Tell me your age:{} your name:{}", iAge, strName);
    }

    std::cout << "Sepnd time=" << Sw.GetElaspsed_Ms() << std::endl;
    Sw.Stop();
}

void SwTest()
{
   TestPocoLogger();
   TestLogger();
}
